import instance from ".";
//请求数据
export function getList(){
  return instance({
    method:"GET",
    url:"/Cart"
  })
}
//增加商品数量
export function addNum(id,num){
   return instance({
    method:"PATCH",
    url:`/Cart/${id}`,
    data:{
      num
    }
   })
}
//添加商品 
export function addItem(obj){
  return instance({
    method:"POST",
    url:"/Cart",
    data:obj
  })
}
//删除商品
export function del(id){
  return instance({
    method:"DELETE",
    url:`/Cart/${id}`,
  })
}

//模糊搜索商品
export function search(obj){
  const url = new URLSearchParams(obj).toString()
  console.log("/Cart?"+url);
  return instance({
    method:"GET",
    url:`/Cart?${url}`
  })
}

//登录 
export function login(obj){
  return instance({
    method:"POST",
    url:"/login",
    data:obj
  })
}
//注册
export function register(obj){
  return instance({
    method:"POST",
    url:"/register",
    data:obj
  })
}